<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript 循环语句</title>
</head>
<body>
<div id="change" class="change">
    <script !src="">
        let array = ["张三", "李四", "王五", "赵六"]
        // 遍历数组，可以使用什么
        for (let i = 0; i < array.length; i++) {
            console.log(array[i]);
        }

        for (let string of array) {
            console.log(string);
        }

        // array.forin

        array.forEach(item => {
            console.log(item);
        })

        let string = "Hello, World!"

        for (let i = 0; i < string.length; i++) {
            console.log(string[i]);
        }

        for (let stringElement of string) {
            console.log(stringElement);
        }

        for (let stringKey in string) {
            // console.log(stringKey);
            console.log(string[stringKey]);
        }

        // string.forEach

        let object = {
            name: "abcque",
            age: 18,
            gender: "M"
        }

        for (let objectKey in object) {
            console.log(objectKey);
            console.log(object[objectKey]);
        }
    </script>
</div>
</body>
</html>